package com.ghsc.ghxc.jsb.ui.mall

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import com.ghsc.ghxc.jsb.ui.live.bean.LiveEndResult
import com.ghsc.ghxc.jsb.ui.live.bean.MaterialInfoBean
import com.ghsc.ghxc.jsb.ui.mall.bean.SuCaiResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.mall
 * 类名：MallViewModel
 * 创建时间：2024/4/23 15:03
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class MallViewModel  : BaseViewModel() {
    /**
     *  素材
     */
    var suCaiListData = MutableLiveData<BaseResponse<SuCaiResult>>()
    fun suCaiListMethod(paras:String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.suCaiListData(paras) }
            executeResponse(
                response,
                { suCaiListData.value = response },
                { againLoginMsg.value = response.msg }
            ) { errorMsg.value = response.msg }
        }
    }
}